package nc.ui.tc.month_schedule_f;

import java.util.ArrayList;
import java.util.List;

import nc.ui.pub.bill.BillCardPanel;
import nc.ui.pub.bill.BillItem;
import nc.ui.pub.config.VarConfig;

public class ShowItem {
	public static void showItem(BillCardPanel billCardPanel) {
		List<String> item = new ArrayList<String>();
		String month=VarConfig.get("monthly_edit").toString();
		String[] items = new String[] { "bzbm", "summary",
				"contractno", 
				"capitalmoney",
				"earlyloanbalances", 
				"borrowdate", 
				"repaymentdate", 
				"yearinterestratio",
				"addcapitalmoney",
				"subcapitalmoney", 
				"loanbalances", 
				"interest",
				"m"+month+"creator",
				"m"+month+"createdate", 
//				"explanation",
//				"maddcapitalmoney","msubcapitalmoney","minterest",
				"remark","aaddcapitalmoney","asubcapitalmoney","ainterest"
//				"adjustinterest","adjustinterestdate",
//				"m"+month+"borrowdate",
//				"m"+month+"repaymentdate",
//				"m"+month+"interestrate",
//				"m"+month+"addcapitalmoney",
//				"m"+month+"subcapitalmoney",
//				"m"+month+"loanbalances",
//				"m"+month+"interest",
//				"m"+month+"adjustinterestdate"
				
				};
		for (int i = 0; i < items.length; i++) {
			item.add(items[i]);
		}

		BillItem[] billItems = billCardPanel.getHeadItems();
		for (int i = 0; i < billItems.length; i++) {
			if (!item.contains(billItems[i].getKey())) {
				billCardPanel.getHeadItem(billItems[i].getKey()).setShow(false);
				billCardPanel.getHeadItem(billItems[i].getKey())
						.getCaptionLabel().setText("");
				billCardPanel.getHeadItem(billItems[i].getKey()).getComponent()
						.setVisible(false);
			}

		}
	}

	public static void hiddenItem(BillCardPanel billCardPanel) {
		List<String> item = new ArrayList<String>();
		String month=VarConfig.get("monthly_edit").toString();
		String[] items = new String[] { "summary", "contractno", "borrowdate",
				"repaymentdate", "capitalmoney", "yearinterestratio",
				"earlyloanbalances", "addcapitalmoney", "subcapitalmoney",
				"loanbalances", "interest","maddcapitalmoney","msubcapitalmoney","minterest","adjustinterest","adjustinterestdate","aaddcapitalmoney","asubcapitalmoney","ainterest" };
		String[] hiddenItem=new String[]{"m1borrowdate","m1repaymentdate","m1interestrate","m1addcapitalmoney","m1subcapitalmoney","m1loanbalances","m1interest","m1proxytaxrate","m1adjustinterestdate"
				,"m2borrowdate","m2repaymentdate","m2interestrate","m2addcapitalmoney","m2subcapitalmoney","m2loanbalances","m2interest","m2proxytaxrate","m2adjustinterestdate",
				"m3borrowdate","m3repaymentdate","m3interestrate","m3addcapitalmoney","m3subcapitalmoney","m3loanbalances","m3interest","m3proxytaxrate","m3adjustinterestdate",
				"m4borrowdate","m4repaymentdate","m4interestrate","m4addcapitalmoney","m4subcapitalmoney","m4loanbalances","m4interest","m4proxytaxrate","m4adjustinterestdate",
				"m5borrowdate","m5repaymentdate","m5interestrate","m5addcapitalmoney","m5subcapitalmoney","m5loanbalances","m5interest","m5proxytaxrate","m5adjustinterestdate",
				"m6borrowdate","m6repaymentdate","m6interestrate","m6addcapitalmoney","m6subcapitalmoney","m6loanbalances","m6interest","m6proxytaxrate","m6adjustinterestdate",
				"m7borrowdate","m7repaymentdate","m7interestrate","m7addcapitalmoney","m7subcapitalmoney","m7loanbalances","m7interest","m7proxytaxrate","m7adjustinterestdate",
				"m8borrowdate","m8repaymentdate","m8interestrate","m8addcapitalmoney","m8subcapitalmoney","m8loanbalances","m8interest","m8proxytaxrate","m8adjustinterestdate",
				"m9borrowdate","m9repaymentdate","m9interestrate","m9addcapitalmoney","m9subcapitalmoney","m9loanbalances","m9interest","m9proxytaxrate","m9adjustinterestdate",
				"m10borrowdate","m10repaymentdate","m10interestrate","m10addcapitalmoney","m10subcapitalmoney","m10loanbalances","m10interest","m10proxytaxrate","m10adjustinterestdate",
				"m11borrowdate","m11repaymentdate","m11interestrate","m11addcapitalmoney","m11subcapitalmoney","m11loanbalances","m11interest","m11proxytaxrate","m11adjustinterestdate",
				"m12borrowdate","m12repaymentdate","m12interestrate","m12addcapitalmoney","m12subcapitalmoney","m12loanbalances","m12interest","m12proxytaxrate","m12adjustinterestdate"};
		for (int i = 0; i < items.length; i++) {
			item.add(items[i]);
		}
		for (int i = 0; i < hiddenItem.length; i++) {
			item.add(hiddenItem[i]);
		}

		BillItem[] billItems = billCardPanel.getHeadItems();
		for (int i = 0; i < billItems.length; i++) {
			if (item.contains(billItems[i].getKey())) {
				billCardPanel.getHeadItem(billItems[i].getKey()).setShow(false);
				billCardPanel.getHeadItem(billItems[i].getKey())
						.getCaptionLabel().setText("");
				billCardPanel.getHeadItem(billItems[i].getKey()).getComponent()
						.setVisible(false);
			}

		}
	}
}
